« Back to channel list

#elixir-lang - 11 May 2019

« Back 1 day Forward 1 day »
[00:10:34] fastfresh: has joined #elixir-lang
[00:18:31] netrino: has joined #elixir-lang
[00:24:34] greengriminal: has joined #elixir-lang
[01:01:09] ur5us: has joined #elixir-lang
[01:04:55] mbuf: has joined #elixir-lang
[01:05:57] carldd: has joined #elixir-lang
[01:15:33] ur5us: has joined #elixir-lang
[01:22:20] ur5us: has joined #elixir-lang
[01:45:48] mbuf: has joined #elixir-lang
[01:50:58] tomterl: has joined #elixir-lang
[01:54:09] griffinbyatt: has joined #elixir-lang
[02:08:53] orbyt_: has joined #elixir-lang
[02:19:02] __charly__: has joined #elixir-lang
[02:35:57] duaneb: has joined #elixir-lang
[02:57:40] pera: has joined #elixir-lang
[03:20:27] cbw_: has joined #elixir-lang
[03:22:24] carldd: has joined #elixir-lang
[03:51:50] mbuf: has joined #elixir-lang
[03:52:49] pera: has joined #elixir-lang
[03:57:18] duaneb: has joined #elixir-lang
[03:57:34] salasrod: has joined #elixir-lang
[03:57:53] tnez: has joined #elixir-lang
[04:21:27] ur5us: has joined #elixir-lang
[04:26:09] Saukk: has joined #elixir-lang
[04:32:19] samof76: has joined #elixir-lang
[04:33:40] jeffweiss: has joined #elixir-lang
[04:34:32] orbyt_: has joined #elixir-lang
[04:48:57] wsieroci: has joined #elixir-lang
[04:53:57] kapilp: has joined #elixir-lang
[05:01:26] gvaughn: has joined #elixir-lang
[05:13:48] helpa-bot: has joined #elixir-lang
[05:14:00] nickjj_: has joined #elixir-lang
[05:15:04] RJ2_: has joined #elixir-lang
[05:15:15] celyr_: has joined #elixir-lang
[05:15:29] alex88_: has joined #elixir-lang
[05:15:36] cryptomata_: has joined #elixir-lang
[05:15:41] profit__: has joined #elixir-lang
[05:16:18] helpa-bot: has joined #elixir-lang
[05:16:42] Poeticode_: has joined #elixir-lang
[05:17:15] juancate_: has joined #elixir-lang
[05:17:24] maxvaill1ncourt1: has joined #elixir-lang
[05:17:48] evax: has joined #elixir-lang
[05:18:01] iFire: has joined #elixir-lang
[05:18:49] helpa: has joined #elixir-lang
[05:51:01] FatalNIX_: has joined #elixir-lang
[05:52:08] iFire: has joined #elixir-lang
[05:52:38] evax: has joined #elixir-lang
[05:53:07] reda: has joined #elixir-lang
[05:53:20] Exagone313: has joined #elixir-lang
[05:55:28] alunduil: has joined #elixir-lang
[06:18:21] DeadTrickster_: how to customize cowboy middleware list?
[06:18:26] DeadTrickster_: when using plug
[06:23:52] Guest55777: has joined #elixir-lang
[06:24:29] jeffweiss: has joined #elixir-lang
[06:44:50] mbuf: has joined #elixir-lang
[06:45:44] DeadTrickster_: actualyl not plugs, but phoenix.
[06:49:21] shiro[cloud]: has joined #elixir-lang
[06:57:45] Guest42: has joined #elixir-lang
[06:58:01] pera: has joined #elixir-lang
[06:59:34] jnoon2: has joined #elixir-lang
[07:13:01] DTZUZO: has joined #elixir-lang
[07:27:28] gvaughn: has joined #elixir-lang
[07:37:57] josevalim: DeadTrickster_: see hexdocs.pm/plug_cowboy
[07:38:06] josevalim: all options in :http in Phoenix are given to the underlying adapter
[07:38:14] squall: has joined #elixir-lang
[07:42:04] DeadTrickster_: yea turned out I have to use protocol_options key
[07:42:16] DeadTrickster_: not sure they work though
[07:43:53] kyrylo: has joined #elixir-lang
[08:15:23] PragTob: has joined #elixir-lang
[08:21:19] m1dnight_: has joined #elixir-lang
[08:22:04] m1dnight_: has joined #elixir-lang
[08:22:41] Saukk: has joined #elixir-lang
[08:26:20] m1dnight_: has joined #elixir-lang
[08:35:29] beatpanic: has joined #elixir-lang
[08:42:33] Nicd-[m]: has joined #elixir-lang
[08:42:33] dyce[m]: has joined #elixir-lang
[08:42:33] Ablu: has joined #elixir-lang
[08:42:33] Anders[m]: has joined #elixir-lang
[08:42:33] MatrixTravelerb4: has joined #elixir-lang
[08:42:34] ejpcmac: has joined #elixir-lang
[08:42:34] uhoreg: has joined #elixir-lang
[08:42:34] Hawkheart[m]: has joined #elixir-lang
[08:42:34] tynanbe: has joined #elixir-lang
[08:42:34] tcit: has joined #elixir-lang
[08:42:35] wilo[m]: has joined #elixir-lang
[08:42:39] is0x3F: has joined #elixir-lang
[08:42:39] borislehashoir[m: has joined #elixir-lang
[08:42:40] Phillipp[m]: has joined #elixir-lang
[08:42:40] MartinFrost[m]: has joined #elixir-lang
[08:42:40] minibikini1: has joined #elixir-lang
[08:42:40] nolan_d: has joined #elixir-lang
[08:42:40] mindflayer[m]: has joined #elixir-lang
[08:42:41] Bla[m]: has joined #elixir-lang
[08:42:41] tkarstens[m]: has joined #elixir-lang
[08:42:41] kamidev[m]: has joined #elixir-lang
[08:42:41] LordPtolemy[m]: has joined #elixir-lang
[08:42:41] hindenbug[m]: has joined #elixir-lang
[08:42:42] chronostamp: has joined #elixir-lang
[08:42:42] whoops: has joined #elixir-lang
[08:42:43] rassilon[m]: has joined #elixir-lang
[08:42:44] krigare[m]: has joined #elixir-lang
[08:44:26] snapet: has joined #elixir-lang
[08:44:47] gvaughn: has joined #elixir-lang
[08:58:27] DeadTrickster_: not sure my middle ware is called though
[09:13:33] blahdodo: has joined #elixir-lang
[09:32:57] lexmag: has joined #elixir-lang
[09:35:35] mbuf: has joined #elixir-lang
[09:41:19] OliverMT: josevalim: windows downloader down, it stalls on downloading flies
[09:41:33] netrino: has joined #elixir-lang
[09:41:44] OliverMT: https://usercontent.irccloud-cdn.com/file/X1LXBDTR/image.png
[10:01:58] gvaughn: has joined #elixir-lang
[10:26:20] Avinash: has joined #elixir-lang
[10:46:40] nickjj: does anyone know what strategy you would use to have a controller test for a phoenix token being expired? it seems like an unsolvable problem with my current knowledge set and the phoenix tests themselves don't show how to do it
[10:47:16] nickjj: the problem i'm having is you set the max age at the verify set, which means you can't set it to -1 during your controller test because the controller test hits the real controller which has a more sane max age like 1 hour
[10:48:10] nickjj: so you wind up in a situation where it feels impossible to test an expired token (i want to make sure certain form errors and flash messages are present), but you can't test that without a conn but you can't make the conn due to the above problem
[10:57:13] blahdodo: has joined #elixir-lang
[10:58:52] geoder101: has joined #elixir-lang
[10:59:01] geoder101_: has joined #elixir-lang
[11:05:44] dysfun: easiest way is to use a behaviour and configure the part of the app responsible to use a test module
[11:14:05] nickjj: dysfun, is behavior the technical term? the docs don't seem to mention it
[11:16:38] wsieroci: has joined #elixir-lang
[11:22:57] dysfun: https://elixir-lang.org/getting-started/typespecs-and-behaviours.html
[11:23:06] dysfun: note the british spelling
[11:23:57] dysfun: i mean you don't technically need to use a behaviour, but you will want two modules that obey the same interface
[11:28:03] nickjj: this looks like something i should probably put on the back burner for now
[11:28:24] dysfun: but it's easy
[11:28:32] dysfun: you just define two modules with the same functions
[11:28:40] nickjj: because it boils down to how do i modify the real application for a test without actually modifying the application to make it worse for non-tests
[11:28:42] dysfun: and add an entry to your config file
[11:28:53] dysfun: and use apply to call it
[11:29:51] nickjj: or more specifically, modify the real application only for 1 specific test
[11:31:30] dysfun: you don't. you make it pluggable, such as by module
[11:31:46] dysfun: and then have a different configuration
[11:32:04] nickjj: the docs on behaviors sounds like what you would do if you wanted to create 1 common interface to multiple things
[11:32:31] dysfun: that's the point, you have one interface and in the two environments, you will call different code
[11:32:37] nickjj: so you might make a payment module with callbacks to handle stripe and paypal payments , and your app accesses the payment module?
[11:32:50] nickjj: but i don't see how this relates to changing a function in a controller based on a test
[11:33:04] dysfun: you do not change a function in a controller, period
[11:33:11] dysfun: that way lies madness
[11:33:32] nickjj: yeah i mean at execution time, the value has to be changed in some way
[11:33:40] dysfun: instead, you define a behaviour with perhaps two callbacks - generate_token and verify_token
[11:34:29] nickjj: currently i have this function in an accounts module that gets called in the controller: def verify_email_auth_token(endpoint, token, max_age \\ 3600) do
[11:35:49] dysfun: and then when you want to do a lookup, you do something like apply(Keyword.fetch!(Application.fetch_env!(Myapp, __MODULE__), :callback_module), :generate_token, [token])
[11:36:52] dysfun: because in controller tests you are typically treating it more or less as a black box, you can't overload the behaviour in any reasonable way other than by having a different config value
[11:37:50] nickjj: can you change config values at runtime?
[11:37:57] dysfun: yes, but why?
[11:38:41] nickjj: what if that function read in the max_age from a standard config value (dev, prod, test) -- and for just the 1 specific test where i want a -1 max age, i set that config value to -1
[11:39:14] dysfun: you could. but if you just want it to return a failure state, you could just do what we do and use the process dictionary to set which mode it operates in
[11:40:07] nickjj: i guess the difference is i know how the config values work
[11:40:22] nickjj: but on the other hand, you're like "it's easy" and then paste apply(Keyword.fetch!(Application.fetch_env!(Myapp, __MODULE__), :callback_module), :generate_token, [token]) , lol
[11:40:41] dysfun: well if you know how config works, Application.fetch_env! shouldn't be mysterious
[11:40:53] dysfun: so when you take that out, it's just a call to apply
[11:41:07] nickjj: yeah, i'm using something similar in that verify function already (it reads the salt value from an env variable)
[11:41:43] dysfun: that doesn't at all seem prone to breakage...
[11:42:21] nickjj: what's wrong with that? this way it's out of version control and can be different per environment
[11:42:28] dysfun: as for the process dict, well you remember those functions i wrote to make faker more useful for properly testing? they use the same trick
[11:44:05] dysfun: but really all you need to know is every process has a process dict, it's a process-global variable, so as long as you remain on the same process, it's like having a global
[11:44:57] nickjj: i don't know enough about OTP to say whether or not being on the same process is guaranteed
[11:46:05] nickjj: it's a pretty simple app in the grand scheme of things tho, it's a single app using phoenix
[11:47:32] dysfun: the problem is config is global
[11:47:43] dysfun: per-process data is actually the right abstraction here imo
[11:48:02] dysfun: but just issuing a fake request to a controller will not change which process it runs on
[11:48:28] DTZUZO: has joined #elixir-lang
[11:48:34] nickjj: when you say fake, is it mocked from the real controller?
[11:48:54] dysfun: no, i mean when you use Phoenix.ConnTest.conn() or such
[11:52:17] dysfun: anyway, basically this trick works for all the things that are not running as their own genservers or such
[11:52:22] nickjj: thanks, i will look into this more, it sounds like something i should get used to doing
[11:52:37] nickjj: right now maybe a config option works, but i'm sure this will come up again with something else where maybe that's not a good idea
[11:53:07] nickjj: for now my fallback plan is to just unit test that verify function (which is simple since i can just pass in -1 at fn call time)
[12:20:05] Saukk: has joined #elixir-lang
[12:33:09] targaf: has joined #elixir-lang
[12:33:57] targaf: has joined #elixir-lang
[12:35:56] gvaughn: has joined #elixir-lang
[12:38:40] targaf: has left #elixir-lang: ()
[12:39:33] targaf: has joined #elixir-lang
[12:59:10] targaf_: has joined #elixir-lang
[13:05:23] duaneb: has joined #elixir-lang
[13:10:17] mitchell: has joined #elixir-lang
[13:22:02] rroslan: has joined #elixir-lang
[13:54:50] pera: has joined #elixir-lang
[14:01:13] Guest42: has joined #elixir-lang
[14:08:50] atk: has joined #elixir-lang
[14:09:50] atk: has joined #elixir-lang
[14:10:12] tnez: has joined #elixir-lang
[14:20:14] hypercore: has joined #elixir-lang
[14:20:30] hypercore: what's the live view equivalent of Routes.page_path?
[14:33:41] greengriminal: has joined #elixir-lang
[14:46:54] mahmudov: has joined #elixir-lang
[14:50:15] voltone: has joined #elixir-lang
[14:52:30] kapilp: has joined #elixir-lang
[14:58:17] lexmag: has joined #elixir-lang
[14:58:45] gvaughn: has joined #elixir-lang
[14:59:38] voltone: has joined #elixir-lang
[15:07:52] Guest42: has joined #elixir-lang
[15:13:36] Sgeo_: has joined #elixir-lang
[15:17:19] Sgeo: has joined #elixir-lang
[15:22:35] oneark: has joined #elixir-lang
[15:23:15] lexmag: has joined #elixir-lang
[15:27:15] Nicd-: hypercore: what was it?
[15:29:12] lexmag: has joined #elixir-lang
[15:34:46] lexmag: has joined #elixir-lang
[15:36:17] hypercore: Nicd-: Routes.live_path(@socket, PageLive.{New,Edit,etc})
[15:36:35] hypercore: * Routes.live_path(@socket, PageLive.{New,Edit,etc}, params \\ [])
[15:37:06] hypercore: e.g. Routes.live_path(conn, PageLive.Edit, page.id)
[15:40:26] lexmag: has joined #elixir-lang
[15:42:49] linduxed: has joined #elixir-lang
[15:45:46] pera: has joined #elixir-lang
[16:05:37] lexmag: has joined #elixir-lang
[16:11:25] lexmag: has joined #elixir-lang
[16:18:05] shymega: has joined #elixir-lang
[16:22:19] __charly__: has joined #elixir-lang
[16:26:51] pera: has joined #elixir-lang
[16:41:02] lexmag: has joined #elixir-lang
[16:48:24] Exuma: has joined #elixir-lang
[16:48:36] pera: has joined #elixir-lang
[16:54:20] pera: has joined #elixir-lang
[17:07:35] Exuma: has joined #elixir-lang
[17:08:36] Guest42: has joined #elixir-lang
[17:21:45] kansi: has joined #elixir-lang
[17:25:41] BitBot: has joined #elixir-lang
[17:43:10] wsieroci: has joined #elixir-lang
[18:03:54] wsieroci: has joined #elixir-lang
[18:13:22] squall: has joined #elixir-lang
[18:14:27] __charly__: has joined #elixir-lang
[18:27:28] nickjj: i'm trying to write a controller test that makes 2 requests as a logged in user, but in the 2nd request i'm logged out, how would i inform the test to use the @tag that sets up current_user?
[18:28:17] nickjj: i tried things like using `recycle(conn)` before i make the 2nd request but it doesn't change the outcome, i'm still logged out
[18:34:14] cagomez: has joined #elixir-lang
[18:43:52] orbyt_: has joined #elixir-lang
[18:44:01] lexmag: has joined #elixir-lang
[18:49:59] lexmag: has joined #elixir-lang
[18:55:42] lexmag: has joined #elixir-lang
[19:01:17] lexmag: has joined #elixir-lang
[19:06:09] kapilp: has joined #elixir-lang
[19:06:57] lexmag: has joined #elixir-lang
[19:12:35] lexmag: has joined #elixir-lang
[19:25:42] lexmag: has joined #elixir-lang
[19:26:22] lexmag: has joined #elixir-lang
[19:29:45] lexmag: has joined #elixir-lang
[19:40:58] lexmag: has joined #elixir-lang
[19:42:05] greengriminal: has joined #elixir-lang
[19:42:45] pera: has joined #elixir-lang
[19:46:57] lexmag: has joined #elixir-lang
[19:51:27] blahdodo: has joined #elixir-lang
[19:52:33] lexmag: has joined #elixir-lang
[19:58:11] lexmag: has joined #elixir-lang
[20:02:08] orbyt_: has joined #elixir-lang
[20:04:27] lexmag: has joined #elixir-lang
[20:16:45] osieln: has joined #elixir-lang
[20:22:31] nickjj: when running a test that calls a function which runs something with Task.start , the logic inside of that Task.start never seems to execute -- what would i look for in the docs to figure out how to test something that runs in the background like that?
[20:23:05] nickjj: for clarity, if i take the exact code inside of that Task.start and put it outside of the Task.start then it works as intended in the test
[20:48:21] pera: has joined #elixir-lang
[20:58:47] kansi: hi! I am trying to figure our how to log raw sql queries executed by ecto(postgres). Can someone please point me in the right direction?
[21:32:14] orbyt_: has joined #elixir-lang
[21:39:54] Sgeo: has joined #elixir-lang
[21:40:17] benwilson512: kansi: if you set your log level to debug you'll just see them printed
[21:41:03] benwilson512: kansi: you can change the level that it prints the logs at with the `log` option as covered here https://hexdocs.pm/ecto/Ecto.Repo.html
[21:43:32] Sgeo_: has joined #elixir-lang
[21:46:22] manveru: can someone please explain to me this bit of erlang? `L32 = [I || <<I:32/unsigned-big>> <= A]` it kinda looks like a list comprehension? how would i translate that to Elixir?
[21:47:48] josevalim: for <<i::32-unsigned-big <- a>>, do: i
[21:51:47] manveru: ah, thanks :D
[22:05:26] Sgeo: has joined #elixir-lang
[22:35:56] dimitarvp: has joined #elixir-lang
[22:41:01] nickjj: does anyone know how to prevent arc from writing out errors during tests that pass? for example this comes out mixed into the ..... output 22:37:50.365 request_id=2mes3r91ip90ojjelg0000b1 [error] {:error, :invalid_file}
[22:47:22] BitBot: has joined #elixir-lang
[22:50:51] gde33: has joined #elixir-lang
[22:51:04] jnoon2: has joined #elixir-lang
[22:56:36] cagomez: has joined #elixir-lang
[23:16:00] weird_error: has joined #elixir-lang
[23:30:43] cagomez: has joined #elixir-lang
[23:47:26] fastfresh: has joined #elixir-lang