def setUp(self):
     super(TestUserAuth, self).setUp()
     self.email = '*****@*****.**'
     user = insert_a_user(email=self.email)
     user.save()
     AcceptedEmailDomains.create(domain='foo.com')
     DepartmentFactory.create(name='New User').save()
     self.department1 = DepartmentFactory.create(name='Test').save()
 def setUp(self):
     super(TestUserAuth, self).setUp()
     self.email = '*****@*****.**'
     user = insert_a_user(email=self.email)
     user.save()
     AcceptedEmailDomains.create(domain='foo.com')
     DepartmentFactory.create(name='New User').save()
     self.department1 = DepartmentFactory.create(name='Test').save()
    def test_build_opportunity_new_user(self):
        self.login_user(self.admin)
        data = {
            'department': str(self.department1.id),
            'contact_email': '*****@*****.**',
            'title': 'test', 'description': 'test',
            'planned_publish': datetime.date.today(),
            'planned_submission_start': datetime.date.today(),
            'planned_submission_end': datetime.date.today() + datetime.timedelta(5),
            'is_public': False, 'subcategories-{}'.format(Category.query.first().id): 'on',
            'opportunity_type': self.opportunity_type.id
        }

        AcceptedEmailDomains.create(domain='foo.com')
        db.session.commit()
        # assert that we create a new user when we build with a new email
        self.assertEquals(User.query.count(), 2)
        self.client.post('/beacon/admin/opportunities/new', data=data)
        self.assertEquals(User.query.count(), 3)
    def test_build_opportunity_new_user(self):
        self.login_user(self.admin)
        data = {
            'department': str(self.department1.id),
            'contact_email': '*****@*****.**',
            'title': 'test',
            'description': 'test',
            'planned_publish': datetime.date.today(),
            'planned_submission_start': datetime.date.today(),
            'planned_submission_end':
            datetime.date.today() + datetime.timedelta(5),
            'is_public': False,
            'subcategories-{}'.format(Category.query.first().id): 'on',
            'opportunity_type': self.opportunity_type.id
        }

        AcceptedEmailDomains.create(domain='foo.com')
        db.session.commit()
        # assert that we create a new user when we build with a new email
        self.assertEquals(User.query.count(), 2)
        self.client.post('/beacon/admin/opportunities/new', data=data)
        self.assertEquals(User.query.count(), 3)