These are chat archives for ecjs/Concierge

18th
Nov 2014
Chareesa Graham
@Chareesa
Nov 18 2014 00:08
When Heroku crashed, what I used to reboot:
heroku ps:scale web=2
Joe Elsey
@joeelsey
Nov 18 2014 00:28
app crashed.
Mark Harrell
@ecjs
Nov 18 2014 00:29
From what...look at heroku logs
Joe Elsey
@joeelsey
Nov 18 2014 00:31
Can't set headers after they are sent. Looking to see what file its doing it in.
Joe Elsey
@joeelsey
Nov 18 2014 00:36
works again
checking to see if I can create a user
Joe Elsey
@joeelsey
Nov 18 2014 00:43
works. weird. header error gone.
was able to create two new users in rapid succession
Going to try and create a user while I'm running the mongo server from my terminal.
I am creating new users with my phone number. No confirmation codes so far from twilio
crashed again. I think there is a connection between accessing the mongo server locally and trying to run the app at the same time.
Mark Harrell
@ecjs
Nov 18 2014 00:48
your local mongo
shouldnt really have anything to do with this
I think that its most likely a database issue
as in..duplicate keys or something
I think I know where the problem is
going to update something now
Joe Elsey
@joeelsey
Nov 18 2014 00:49
cool
btw I was able to create an entirely duplicate user. by accident
Mark Harrell
@ecjs
Nov 18 2014 00:49
yah, I dont necessarily think thats the issue
but ya
validation
if Users.find({username: req.body.username}) return GTFO
or something like that
ok
so there is two res.send(err)
in register_user.js
thats that the sending headers issue is from
wait that might not be it
let me try and replicate
Joe Elsey
@joeelsey
Nov 18 2014 00:55
So
Its up again with no changes
Mark Harrell
@ecjs
Nov 18 2014 00:56
what is
Joe Elsey
@joeelsey
Nov 18 2014 00:56
The app
Mark Harrell
@ecjs
Nov 18 2014 00:56
going to try and replicate some errors
Joe Elsey
@joeelsey
Nov 18 2014 00:56
I'm wondering if there's an uncaught exception crashing the app. How the app is restarting is something I can't figure out.
Mark Harrell
@ecjs
Nov 18 2014 00:56
can you look at your heroku logs
you need to trace the error to the line
thats causing it
Joe Elsey
@joeelsey
Nov 18 2014 00:57
Heroku logs gives me the content header error and points to register_user.js
24:29
Mark Harrell
@ecjs
Nov 18 2014 00:57
hmm
Joe Elsey
@joeelsey
Nov 18 2014 00:57
ah
got it
sending the same user twice creates the error
Mark Harrell
@ecjs
Nov 18 2014 00:58
but we arent doing that
those are two diff errors
Joe Elsey
@joeelsey
Nov 18 2014 00:58
I just did it
to test
I created a user. It worked. I then posted the same user again and crashed
I too enjoy breaking code.
looking at the logs now
Mark Harrell
@ecjs
Nov 18 2014 00:59
ahh
I see the problem.
so what happens is
there is an error saving the user to the database..
but, we dont find out what that error is(potentially), because it tries to res.json outside of that
the user generated token
we might have to nest that in an else statement
or something like that
Joe Elsey
@joeelsey
Nov 18 2014 01:00
I moved it back in once
Mark Harrell
@ecjs
Nov 18 2014 01:00
let me try and fix this a little bit
Joe Elsey
@joeelsey
Nov 18 2014 01:00
I got the could not send confirmation code
Mark Harrell
@ecjs
Nov 18 2014 01:00
either way, the problem is most likely from duplicate users
Joe Elsey
@joeelsey
Nov 18 2014 01:01
I moved it out again and it let me create a user
Mark Harrell
@ecjs
Nov 18 2014 01:01
every time you create a user
you might want to drop your database
or user a diff username
but I dont think thats what it is
because we dont require a unique username
Joe Elsey
@joeelsey
Nov 18 2014 01:01
well I shouldn't be able to create a new user or we should catch the error and not crash
Mark Harrell
@ecjs
Nov 18 2014 01:01
let me spend a few minutes debugging this
Joe Elsey
@joeelsey
Nov 18 2014 01:02
cool
Mark Harrell
@ecjs
Nov 18 2014 01:05
joe have you still not received a text
from the app
Joe Elsey
@joeelsey
Nov 18 2014 01:05
nope
Mark Harrell
@ecjs
Nov 18 2014 01:05
drop the database
and use this
{"username":"mark2243",
"password":"password123",
"phone":"3607393580",
"name":{"first":"mark","last":"harrell"}
}
except
change my number out for yours
{"username":"mark2243",
 "password":"password123",
 "phone":"3607393580",
 "name":{"first":"mark","last":"harrell"}
}
Joe Elsey
@joeelsey
Nov 18 2014 01:06
db has been dropped
Mark Harrell
@ecjs
Nov 18 2014 01:06
and by db I meant your user collection in mongloabs
mongolabs*
Joe Elsey
@joeelsey
Nov 18 2014 01:07
yep
db.users.drop()
Mark Harrell
@ecjs
Nov 18 2014 01:07
are you logged into
terminak
terminal*/shell
Joe Elsey
@joeelsey
Nov 18 2014 01:07
Yes.
Mark Harrell
@ecjs
Nov 18 2014 01:07
got it
Joe Elsey
@joeelsey
Nov 18 2014 01:07
Should I close the db?
the terminal that is? Heroku app hasn't reset yet like last time.
Mark Harrell
@ecjs
Nov 18 2014 01:07
no
the only thing you should be doing
Joe Elsey
@joeelsey
Nov 18 2014 01:08
I should be able to stay logged into the db.
Mark Harrell
@ecjs
Nov 18 2014 01:08
yes
the only thing you need to be doing is dropping the user collection
I do it from mongolab.com
Joe Elsey
@joeelsey
Nov 18 2014 01:08
I do it from terminal
Mark Harrell
@ecjs
Nov 18 2014 01:10
db.users.drop() should be sufficient
Joe Elsey
@joeelsey
Nov 18 2014 01:10
app is still down. post didn't go through.
Mark Harrell
@ecjs
Nov 18 2014 01:10
why is the app down..
Joe Elsey
@joeelsey
Nov 18 2014 01:10
checking the logs
don't know.
headers again
let me try something.
Mark Harrell
@ecjs
Nov 18 2014 01:10
its a duplicate user issue or something
dunno
very odd
Joe Elsey
@joeelsey
Nov 18 2014 01:11
nah. i'm using the info you gave me
Mark Harrell
@ecjs
Nov 18 2014 01:11
oh
ya..it sent me a confirmation number
:)
something is changed on your file locally maybe
did you not change the phone number
its adding it to your database
its working fine over here for me
Joe Elsey
@joeelsey
Nov 18 2014 01:12
ok
Mark Harrell
@ecjs
Nov 18 2014 01:13
make sure you have content-type application/json
Joe Elsey
@joeelsey
Nov 18 2014 01:13
I closed the db and did a new push on heroku
I opened the app. It works. I created the user based on the info you gave me. was given a jwt
Let me know if you get a confirmation code
Mark Harrell
@ecjs
Nov 18 2014 01:14
no code yet
Joe Elsey
@joeelsey
Nov 18 2014 01:14
Try using my number again to create a user.
Maybe its something on my end
Although our code should be identical
Mark Harrell
@ecjs
Nov 18 2014 01:15
I havent received my Twilio text yet..I just sent myself one
btw
you can look at your twilio logs
for sent text messages
Joe Elsey
@joeelsey
Nov 18 2014 01:18
where
you can also look at calls
btw duplicate anything is ok
been sending the same duplicate post
over and over
getting sms
Joe Elsey
@joeelsey
Nov 18 2014 01:20
hrm
no calls or sms in my twilio logs
even though I did receive some to my number
Mark Harrell
@ecjs
Nov 18 2014 01:21
hmm
maybe some process.env variables are wrong
do heroku config:get
Joe Elsey
@joeelsey
Nov 18 2014 01:21
my number is verified under caller ids
Mark Harrell
@ecjs
Nov 18 2014 01:21
or heroku config
Joe Elsey
@joeelsey
Nov 18 2014 01:21
ok
should I check my auth token"
?
Mark Harrell
@ecjs
Nov 18 2014 01:22
umm..your auth token shouldnt be there
o wiat
for twilio
check all of the variables
your phone number
all of it
TWILIO_ACCOUNT_SID: AC7277b2d36d056cb742981f4f239d3ba6
TWILIO_AUTH_TOKEN: a3e704ebb659af403eb8022324e98889
TWILIO_NUMBER: +16024836024
thats mine
running heroku config
Joe Elsey
@joeelsey
Nov 18 2014 01:23
should I use my twilio number?
I don't have my twilio number set in my cofig
set it
BOOSH
Confirm code
Mark Harrell
@ecjs
Nov 18 2014 01:27
there ya go
gotta have those variables set
Joe Elsey
@joeelsey
Nov 18 2014 01:28
I'm signing up my wife. I want to see if she gets the text :)
Mark Harrell
@ecjs
Nov 18 2014 01:28
lol
so the problem you were seeing
since there wasnt a twilio number set
it was res.sending that error
and then trying to res.send the json
web token
so I changed that file
going to update to dev now
Joe Elsey
@joeelsey
Nov 18 2014 01:30
Should I put that line inside of the client.sendmessage?
Mark Harrell
@ecjs
Nov 18 2014 01:30
no
Joe Elsey
@joeelsey
Nov 18 2014 01:30
ok
Mark Harrell
@ecjs
Nov 18 2014 01:30
I am making the changes now
pushing up
Mark Harrell
@ecjs
Nov 18 2014 01:36
so dev has been updated with that albeit minor change
but that should fix that error from bubbling up
Joe Elsey
@joeelsey
Nov 18 2014 01:40
fetched
Mark Harrell
@ecjs
Nov 18 2014 01:41
I am currently adding a route for resending user confirmation
if they didnt get it
Joe Elsey
@joeelsey
Nov 18 2014 01:41
Curretly working on the first user test
simple mocha doesn't really like the json format
holy shit. test 1 passed
Mark Harrell
@ecjs
Nov 18 2014 01:43
holy. shit.
what was test 1
Joe Elsey
@joeelsey
Nov 18 2014 01:44
create a user
how do I confirm a user again?
Mark Harrell
@ecjs
Nov 18 2014 01:44
you would have to use the sms code sent
Joe Elsey
@joeelsey
Nov 18 2014 01:44
I have that confirmation number
Mark Harrell
@ecjs
Nov 18 2014 01:45
you send that to /confirm using confirmationCode
Joe Elsey
@joeelsey
Nov 18 2014 01:45
Shit. That's almost impossible to test. Because I have to create the user to the get the sms....
Mark Harrell
@ecjs
Nov 18 2014 01:45
well
here is the thing
the confirmation code is stored in the user
Joe Elsey
@joeelsey
Nov 18 2014 01:45
i see it
Mark Harrell
@ecjs
Nov 18 2014 01:46
so user.confirmationCode
Joe Elsey
@joeelsey
Nov 18 2014 01:46
much easier now
so my create user test is creating a user, but with no name or anything... I supposed that is a plus. I'll work on it
Mark Harrell
@ecjs
Nov 18 2014 01:51
yah..odd..that sounds like a json prob
make sure to send it as json
dont just send it like you did other auth
Joe Elsey
@joeelsey
Nov 18 2014 01:53
yes. worked again
cool
moving along here
How would you get a user again? By the jwt token or the confirmation code?
Or by their username?
Mark Harrell
@ecjs
Nov 18 2014 01:55
jwt
Joe Elsey
@joeelsey
Nov 18 2014 01:55
ok. for the auth auth test I had to login
username and password
Annnd I can get a user now
Mark Harrell
@ecjs
Nov 18 2014 01:58
gj
Joe Elsey
@joeelsey
Nov 18 2014 01:59
cfbot image me randy savage snap
nooooo
doesn't work in here.
Mark Harrell
@ecjs
Nov 18 2014 01:59
lol!
Joe Elsey
@joeelsey
Nov 18 2014 02:07
I have 14 text messages from twilio
Mark Harrell
@ecjs
Nov 18 2014 02:08
LOL
why
oh man I miss randy savage
SNAP IT TO A SLIM JIM!
Joe Elsey
@joeelsey
Nov 18 2014 02:09
so your confirmation code post in confirm users
how would i enter that in post man?
Mark Harrell
@ecjs
Nov 18 2014 02:09
you can use url params
or {“confirmationCode”:”234234”}
created a route for reconfirming user
resending sms text
Joe Elsey
@joeelsey
Nov 18 2014 02:10
they way your post is setup is I enter an _id and confirmationCode
So that's what I'm testing for. User has _id and confirmationCode.
Mark Harrell
@ecjs
Nov 18 2014 02:11
umm, well thats how you get the confirmation code
it pulls the user id
from jwtauth
req.user._id
Joe Elsey
@joeelsey
Nov 18 2014 02:15
ok
Mark Harrell
@ecjs
Nov 18 2014 02:15
ok pushed another update to dev
this has the resendConfirmation route
Joe Elsey
@joeelsey
Nov 18 2014 02:18
would confirmed false be ok?
Since the user hasn't entered their confirmation code in yet?
probably not
Mark Harrell
@ecjs
Nov 18 2014 02:21
sure
thats not a big deal
the confirmed test isnt an issue
Joe Elsey
@joeelsey
Nov 18 2014 02:21
let me try some other stuff and I'll come back to it if I have to
I guess its false. I just created a new user and posted his jwt to the confirm. Came up false. I'm going to set the test as false for now.
I did this in postman
Joe Elsey
@joeelsey
Nov 18 2014 02:27
scratch that. changed the test to have property confirmed
passed
Currently there is no route for getting a confirmed user.
Mark Harrell
@ecjs
Nov 18 2014 02:30
what do you mean
Joe Elsey
@joeelsey
Nov 18 2014 02:31
nm
i'm wrong
one sec. moving fast here
Chareesa Graham
@Chareesa
Nov 18 2014 02:32
Can I add a password confirm to the User Schema?
Mark Harrell
@ecjs
Nov 18 2014 02:33
we can either do the password confirm there or in the frontend
I think it makes the most sense on the frontend (ie the iOS app or in the future the angular app)
saves us a database call
Joe Elsey
@joeelsey
Nov 18 2014 02:34
Not sure how to get a true message out of confirm user
Mark Harrell
@ecjs
Nov 18 2014 02:34
when you confirm the user
Joe Elsey
@joeelsey
Nov 18 2014 02:34
Tried using a jwt from a user created in the db, but all of them come up false
Mark Harrell
@ecjs
Nov 18 2014 02:34
when you create the user, it should return the user object
i mean when you confirm the user
the user object should have confirmed: true in it
Joe Elsey
@joeelsey
Nov 18 2014 02:35
The steps I've have taken so far is to create the user, then post the user's jwt into the cofirm route.
this gives a false
Chareesa Graham
@Chareesa
Nov 18 2014 02:40
For passwords.. we want them to include a number, an uppercase, and have a min length? Length of 6? Cause I got a regex for that.
Mark Harrell
@ecjs
Nov 18 2014 02:41
sure, works for me ;)
Joe Elsey
@joeelsey
Nov 18 2014 02:48
in confirm_user I feel like the user === null is bad
Mark Harrell
@ecjs
Nov 18 2014 02:49
basically that just says, if user.findOne doesnt find anything, then basically the confirmation failed
but we have to have something to catch that..because it doesnt spit out an error.
Joe Elsey
@joeelsey
Nov 18 2014 02:51
yeah. user.findOne isn't finding anything
at least when I enter the jwt token it doesn't.
trying to figure it out. last test for users at the moment.
Mark Harrell
@ecjs
Nov 18 2014 02:52
hmm..post the code for the test in here
```
Joe Elsey
@joeelsey
Nov 18 2014 02:52
it('should get a confirmed user', function(done){
    chai.request('https://quiet-dusk-4540.herokuapp.com')
      .post('/confirm')
      .set({jwt:jwtToken})
      .end(function(err,res){
        expect (err).to.be.eql(null);
        expect (res.body.confirmed).to.be.true;
      });
  });
Mark Harrell
@ecjs
Nov 18 2014 02:54
have you tried console logging the res.body
to see whats sitting in it
so here is the problem
Joe Elsey
@joeelsey
Nov 18 2014 02:55
I tried console logging the user param
Mark Harrell
@ecjs
Nov 18 2014 02:55
basically, you are just posting the jwttoken
to /confirm
/confirm is supposed to take the confirmationCode
Joe Elsey
@joeelsey
Nov 18 2014 02:56
so {confirmationCode: res.body.confirmationCode} ?
Mark Harrell
@ecjs
Nov 18 2014 02:56
right, but you wont get the confirmation code
right..
that comes from sms
Joe Elsey
@joeelsey
Nov 18 2014 02:57
yep
but it is set in the db
Mark Harrell
@ecjs
Nov 18 2014 02:57
so we need a way of retrieving that out of the db
Joe Elsey
@joeelsey
Nov 18 2014 02:58
wait
maybe I can set a var in my before
one sec
no
trying to figure out a way to grab the code from the db
Mark Harrell
@ecjs
Nov 18 2014 03:12
alright updated the /jobs route to allow a get request for all jobs for the users id
Joe Elsey
@joeelsey
Nov 18 2014 03:12
ok. Was going to see if there was a way to call the usersfindone in the chai test
Joe Elsey
@joeelsey
Nov 18 2014 03:21
ok and I can't fetch the upstream for some reason
wtf
Chareesa Graham
@Chareesa
Nov 18 2014 03:21
Right now, I'm working on fixing the app crash when it
's given a wrong input
Joe Elsey
@joeelsey
Nov 18 2014 03:21
i'm 3 commits behind
Chareesa Graham
@Chareesa
Nov 18 2014 03:22
weird...
Mark Harrell
@ecjs
Nov 18 2014 03:42
just pushed an update to dev
added the conciergeUnavailable route
Joe Elsey
@joeelsey
Nov 18 2014 03:47
I just noticed jscs was only checking server.js
I've got some work to do
Also, let me know if you can get a confirmed true message on your code confirmation
Currently the way the route is setup I don't think you can.
Mark Harrell
@ecjs
Nov 18 2014 03:49
we can setup a get request..
on the /confirm route
doing that now
Joe Elsey
@joeelsey
Nov 18 2014 04:00
jscs fixed
everything works still
Mark Harrell
@ecjs
Nov 18 2014 04:01
nice!
give me one second
Joe Elsey
@joeelsey
Nov 18 2014 04:01
you'll notice quite a few 'quotes' are missing from your jsons
Mark Harrell
@ecjs
Nov 18 2014 04:01
when you res.json
I dont think it matters
it parses it appropriately
is that what you were talking about?
for instance
res.status(200).json({confirmed: req.user.confirmed});
Joe Elsey
@joeelsey
Nov 18 2014 04:05
well
in confirm user its not returning the user. only the false message
I merged your commits
Mark Harrell
@ecjs
Nov 18 2014 04:05
ok
Joe Elsey
@joeelsey
Nov 18 2014 04:05
I'm caught up and now the app isi crashing
Mark Harrell
@ecjs
Nov 18 2014 04:05
actually just finished
you need to run it again
/confirmed route
thats where you can tell if the user is confirmed or not
Joe Elsey
@joeelsey
Nov 18 2014 04:06
your <<<<<<
is crashing the ap
Mark Harrell
@ecjs
Nov 18 2014 04:08
wait what
?
Joe Elsey
@joeelsey
Nov 18 2014 04:08
fixed
the <<<<<head was crashing the ap
I deleted them, reloaded and it works
Mark Harrell
@ecjs
Nov 18 2014 04:09
so that <<<< head is from merge conflicts.
that only comes in when you try and pull down a merge that conflicts with code that you have edited.
Joe Elsey
@joeelsey
Nov 18 2014 04:09
ah
first time for everything
well everything is passing jshint and jscs. First three user tests pass. I'm wondering if I should give up on the last user confirmation test for now and move onto confirming concierge
concierge users
Mark Harrell
@ecjs
Nov 18 2014 04:10
up to you..
Joe Elsey
@joeelsey
Nov 18 2014 04:11
I'm going to pass because tomorrow I'd like to see you post to user confirmations and get back a user instead of {confirmed:false}
can you show me your test
that you are trying to pass
paste code in here
Joe Elsey
@joeelsey
Nov 18 2014 04:13
it('should get a confirmed user', function(done){
    chai.request('https://quiet-dusk-4540.herokuapp.com')
      .post('/confirm')
      .send({jwt:jwtToken})
      .end(function(err,res){
        expect (err).to.be.eql(null);
        expect (res.body).to.be.true;
      });
  });
same as before
here's what its testing
app.post('/confirm', jwtauth, function(req, res) {
    var confirmation = req.body.confirmationCode;
    console.log(confirmation);
    User.findOne({_id: req.user._id, confirmationCode: confirmation}, function(err, user) {
      console.log(confirmation);
      if (user === null) {
        console.log(confirmation);
        return res.status(500).json({confirmed: false});
      }
      if (err) { return (err); }
      user.confirmed = true;
      user.save(function(err) {
        if (err) { return (err); }
        return res.status(202).json(user);
      });
    });
  });
I should enter in a jwt. The jwt should populate the _id and confirmationCode json
Mark Harrell
@ecjs
Nov 18 2014 04:14
ok..so there is a couple of issues here.
Joe Elsey
@joeelsey
Nov 18 2014 04:14
if both are present a user should be returned
Mark Harrell
@ecjs
Nov 18 2014 04:15
so the app.post..
what that route is doing
is taking in the request, that contains the users confirmation code from the SMS that we sent them when they first registered
confirmationCode = the users SMS code that we sent to them
so in order to confirm the user, you need to have the SMS code.
Joe Elsey
@joeelsey
Nov 18 2014 04:15
but the code is also present in the db
Mark Harrell
@ecjs
Nov 18 2014 04:16
but the code is not being provided
either in the response or the request
as far as the test is concerned..
there is no code
Joe Elsey
@joeelsey
Nov 18 2014 04:16
so always false?
Sorry if I'm not getting this
Mark Harrell
@ecjs
Nov 18 2014 04:17
well yes..when you make a post to /confirm, and you do not have the sms code..you are always going to get back..confirmed:false
because the user is not confirmed without their SMS code
Joe Elsey
@joeelsey
Nov 18 2014 04:17
ok
Mark Harrell
@ecjs
Nov 18 2014 04:17
if you have quite a bit of work done/tests passing
and you are all caught up with changes (i would do a fetch just in case to make sure you are)
send the push in
and I will look at your code
and we can brainstorm
Joe Elsey
@joeelsey
Nov 18 2014 04:21
lol. now I'm getting a timeout error
for that last teset
test
I'm caught up
with dev
weird timeout error on the last test.
fixed.
missing the done();
user tests all green
Mark Harrell
@ecjs
Nov 18 2014 04:26
nice
Joe Elsey
@joeelsey
Nov 18 2014 04:27
travis is being weird
says it can't find server.js, but I have no idea why its looking where its looking
Mark Harrell
@ecjs
Nov 18 2014 04:30
so in your user test
require('../../server');
it should only be
require('../server');
look back one folder instead of two
Joe Elsey
@joeelsey
Nov 18 2014 04:32
my simple mocha tasks don't run if I just have ../
Mark Harrell
@ecjs
Nov 18 2014 04:33
not sure what to tell you there..the ../server is what it should be
Joe Elsey
@joeelsey
Nov 18 2014 04:34
Running "simplemocha:src" (simplemocha) task
Warning: Cannot find module '../../server' Use --force to continue.
something is messed up
I got rid of the ../
I'm still seeing two concierges in travis as well
Mark Harrell
@ecjs
Nov 18 2014 04:35
well that shouldnt be the problem
Joe Elsey
@joeelsey
Nov 18 2014 04:36
Well the build passed. But only because simplemocha didn't run any tests with the ../
Mark Harrell
@ecjs
Nov 18 2014 04:36
hmm
can you give me the link to the travis test
I could run it for you tomorrow if you want?
Mark Harrell
@ecjs
Nov 18 2014 04:39
I think I know what the problem is
simplemocha: {
      options: {
        timeout: 3000,
        ignoreLeaks: false,
        reporter: 'tap'
      },
      src: ['test/**/user_test.js']
try using src test/user_test.js
without that **
Joe Elsey
@joeelsey
Nov 18 2014 04:42
None of my simple mocha tests are working now. About to flip the table
I even changed it back and nothing
fixed
man i'm going crazy
Mark Harrell
@ecjs
Nov 18 2014 04:43
:)
usually its something small
lets watch it update together
see what happens
Mark Harrell
@ecjs
Nov 18 2014 04:45
lol
Joe Elsey
@joeelsey
Nov 18 2014 04:46
i hate travis
Mark Harrell
@ecjs
Nov 18 2014 04:46
do me a favor
change ../../
process.env.MONGO_URL = 'mongodb://concierge:foobar123@ds053190.mongolab.com:53190/concierge';
var chai = require('chai');
var chaihttp = require('chai-http');
var User = require('../models/user_model.js');
chai.use(chaihttp);

require('../../server');
instead of that
this

process.env.MONGO_URL = 'mongodb://concierge:foobar123@ds053190.mongolab.com:53190/concierge';
var chai = require('chai');
var chaihttp = require('chai-http');
var User = require('../models/user_model.js');
chai.use(chaihttp);

require('../server');
you have an extra ../
that test file is looking back past where server is
Joe Elsey
@joeelsey
Nov 18 2014 04:48
when I change that simple mocha doesnt run any tests
it just says passes and done
Mark Harrell
@ecjs
Nov 18 2014 04:51
well thats the correct syntax there
so fix that
and then we can move from there
Joe Elsey
@joeelsey
Nov 18 2014 04:53
Ok
I'm about to have a meltdown. I was probably testing a server.js file above the concierge file
what I don't understand is I was getting values back from everything
I can find the server with in the concierge file and I'm running tests with no errors.
It doesn't make any sense
Mark Harrell
@ecjs
Nov 18 2014 04:57
so if u could..go ahead and push up to dev..
have you fetched the most recent additions
to dev
Joe Elsey
@joeelsey
Nov 18 2014 04:59
yes
I tried running mocha directly from my users test
Mark Harrell
@ecjs
Nov 18 2014 04:59
what happened
Joe Elsey
@joeelsey
Nov 18 2014 04:59
apparently my twilio number is set wrong because I have the + in front of my number
changing it now
RestClient requires an Account SID and Auth Token set explicitly or via the TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN environment variables
Ever seen this?
Mine are set
Mark Harrell
@ecjs
Nov 18 2014 05:02
so basically
you cant run anything locally
so if you are trying to run the tests locally
I need to look at your code..
one sec
right so basically, you are running it locally
its not going to work
you are including the ../server file
Joe Elsey
@joeelsey
Nov 18 2014 05:04
so get rid of it?
Mark Harrell
@ecjs
Nov 18 2014 05:04
no
dont try and run it locally
also, for travis..
you are going to need to set the process.env variables
at the very top of the test file
similar to how you did with the Mongo url
so set all of your variables (although it won’t really use any of them)
Joe Elsey
@joeelsey
Nov 18 2014 05:05
ok
I think I fixed it
Mark Harrell
@ecjs
Nov 18 2014 05:05
you just cant test locally,
because of twilio
Joe Elsey
@joeelsey
Nov 18 2014 05:06
I commented out the require server and it ran the tests
Mark Harrell
@ecjs
Nov 18 2014 05:06
yah, thats not a bad idea
Joe Elsey
@joeelsey
Nov 18 2014 05:06
let me repush.
Mark Harrell
@ecjs
Nov 18 2014 05:06
we really dont need the server
Joe Elsey
@joeelsey
Nov 18 2014 05:06
maybe this evening wasn't a waste of time after all
Mark Harrell
@ecjs
Nov 18 2014 05:06
because all the tests are happening remotely
thats why the tests were successfuly
running before
does that make sense though? with twilio? and why we cant run tests locally
Joe Elsey
@joeelsey
Nov 18 2014 05:08
yes
I didn't think I was running the tests locally, but I was
I didn't realize because i was getting texts and the db was updating
build passed. tests ran
Mark Harrell
@ecjs
Nov 18 2014 05:09
well done
Joe Elsey
@joeelsey
Nov 18 2014 05:09
you want me to create a pull request.
Mark Harrell
@ecjs
Nov 18 2014 05:09
yup
Joe Elsey
@joeelsey
Nov 18 2014 05:09
I think I should book out of here
Mark Harrell
@ecjs
Nov 18 2014 05:09
no prob
I will merge it if all looks good
and take a closer look at tests
Joe Elsey
@joeelsey
Nov 18 2014 05:10
please do
second pair of eyes would be nice
Mark Harrell
@ecjs
Nov 18 2014 05:11
so question
I was told that ‘_id'
was required
like it wont work
Jobs.remove({_id: job._id}, function(err) {
Joe Elsey
@joeelsey
Nov 18 2014 05:12
hrm
jscs didn't like it
Mark Harrell
@ecjs
Nov 18 2014 05:12
right
tyler told us to ignore that
in class
Joe Elsey
@joeelsey
Nov 18 2014 05:12
then I'll have to make an exception for jscs and add those quotes back in
Mark Harrell
@ecjs
Nov 18 2014 05:12
ya
I would do that before we merge this
so close that pull request
let me research that
Joe Elsey
@joeelsey
Nov 18 2014 05:13
done
I'm going to look for the exception before I leave
Mark Harrell
@ecjs
Nov 18 2014 05:13
we might want to look into this a bit more
I havent really tried it without the quotes
I just remember them saying that
Joe Elsey
@joeelsey
Nov 18 2014 05:14
Well. Even though the tests pass I didn't receive any texts
may be an issue
let me try creating a user
I was just able to create a user and got a text
so current build works without quotes on my end, but I won't do another pull request until tomorrow morning
Mark Harrell
@ecjs
Nov 18 2014 05:16
ok
let me look into it
I am going to make a simple change, and push it to heroku
to test if removing those quotes is a problem or not
Mark Harrell
@ecjs
Nov 18 2014 05:21
ok joe
it works
sooooo
tyler was wrong
Joe Elsey
@joeelsey
Nov 18 2014 05:22
pull request?
Mark Harrell
@ecjs
Nov 18 2014 05:22
yup
do it
with those silly ole ‘ gone
dont need em
worked just fine without
Joe Elsey
@joeelsey
Nov 18 2014 05:24
the only weird thing is the test passes, but doesn't send me a text. When I create a user normally I get a text. Maybe its supposed to work that way?
Mark Harrell
@ecjs
Nov 18 2014 05:24
hmm
I will test
on my end
see if it works
Joe Elsey
@joeelsey
Nov 18 2014 05:24
it will work
if you create a user you get the jwt and the confirmation text
if you run the test the test will pass because it gets a jwt for user create, but no text
which isn't a terrible thing because I deleted about sixty texts from my phone.
Mark Harrell
@ecjs
Nov 18 2014 05:25
LOL
omg
awesome
ok
merged it
going to pull down to my local now
Joe Elsey
@joeelsey
Nov 18 2014 05:26
test it before I leave
Mark Harrell
@ecjs
Nov 18 2014 05:27
ok
really quick..
Joe Elsey
@joeelsey
Nov 18 2014 05:28
i'm here
Mark Harrell
@ecjs
Nov 18 2014 05:28
putting your mongo url in git is not a good idea
usually what you want to do..is install mongo as a local service in travis
i dont even think its running any database calls here though
Joe Elsey
@joeelsey
Nov 18 2014 05:29
ok. so set that as an env?
Mark Harrell
@ecjs
Nov 18 2014 05:29
I dont think we make any db calls in here
Joe Elsey
@joeelsey
Nov 18 2014 05:29
get rid of it?
Thought I needed it for tests...
Mark Harrell
@ecjs
Nov 18 2014 05:29
hmm maybe, maybe not
I will work on it a little bit
you head out
if we dont need it I will remove it
Joe Elsey
@joeelsey
Nov 18 2014 05:30
Cool
Sorry for the drama. But I strongley believe this is a working test of the user routes
Mark Harrell
@ecjs
Nov 18 2014 05:30
no drama…this is just how it goes
you have given us a good start for tests..
Joe Elsey
@joeelsey
Nov 18 2014 05:30
Aweomse
Positive mental attitude
Mark Harrell
@ecjs
Nov 18 2014 05:31
yah ;)
Joe Elsey
@joeelsey
Nov 18 2014 05:31
Ok. Heading out
:)
Mark Harrell
@ecjs
Nov 18 2014 05:31
later!
thanks!
Joe Elsey
@joeelsey
Nov 18 2014 05:31
Thank you
Chareesa Graham
@Chareesa
Nov 18 2014 05:38
Yay!! I got password requirements and I got it checking to see if the user name already exists..
took longer than I thought cause I ran into so many errors!
like it CRASHING every wrong turn
Mark Harrell
@ecjs
Nov 18 2014 06:04
lol
good job!@
did you merge the updated dev
from upstream
before doing this pull request
went ahead and merged
there are a few code style errors
I will take care of those ;)
Mark Harrell
@ecjs
Nov 18 2014 06:11
all fixed, tests passing now
Chareesa Graham
@Chareesa
Nov 18 2014 15:59
Oops, sorry. Just read this. I merged, yes.
Joe Elsey
@joeelsey
Nov 18 2014 17:02
I just merged the current repo. I ran a quick grunt test this morning and noticed the changed url. I'm going to keep the user test that url for today since it works.
Chareesa Graham
@Chareesa
Nov 18 2014 20:49
For the bash profile:
export TWILIO_ACCOUNT_SID=
export TWILIO_AUTH_TOKEN=
export TWILIO_NUMBER=+
.bash_profile
open ~/.bash_profile