Exemplo n.º 1
0
 def setUp(self):
     self.user = test_data.createDummyUserRandom(login='******',
                                                 password='******')
     self.another_user = test_data.createDummyUserRandom(login='******',
                                                         password='******')
     self.client = Client()
     self.client.login(username=self.user.username, password='******')
    def test_should_send_mail_for_new_comments(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.get('/core/watch/issue/%s'%issue.id)
        self.assertEqual(response.status_code, 200)
        response = self.client.get('/core/watch/offer/%s'%offer.id)
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login='******', password='******')
        client2 = Client()
        client2.login(username=user2.username, password='******')

        email_asserts.clear_sent()
        response = client2.post('/core/issue/comment/add/submit', {'issue_id': str(issue.id), 'content': 'Im adding a comment'})
        self.assertEqual(response.status_code, 302)

        email_asserts.send_emails()
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s added a comment on issue [%s]"%(user2.getUserInfo().screenName, issue.title))

        email_asserts.clear_sent()
        response = client2.post('/core/offer/comment/add/submit', {'offer_id': str(offer.id), 'content': 'Im adding another comment'})
        self.assertEqual(response.status_code, 302)

        email_asserts.send_emails()
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s added a comment on offer [US$ %s / %s]"%(user2.getUserInfo().screenName, '10.00', issue.title))
Exemplo n.º 3
0
    def test_should_send_mail_for_new_comments(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.get('/core/watch/issue/%s'%issue.id)
        self.assertEqual(response.status_code, 200)
        response = self.client.get('/core/watch/offer/%s'%offer.id)
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login='******', password='******')
        client2 = Client()
        client2.login(username=user2.username, password='******')

        email_asserts.clear_sent()
        response = client2.post('/core/issue/comment/add/submit', {'issue_id': str(issue.id), 'content': 'Im adding a comment'})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s added a comment on issue [%s]"%(user2.getUserInfo().screenName, issue.title))

        email_asserts.clear_sent()
        response = client2.post('/core/offer/comment/add/submit', {'offer_id': str(offer.id), 'content': 'Im adding another comment'})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s added a comment on offer [US$ %s / %s]"%(user2.getUserInfo().screenName, '10.00', issue.title))
Exemplo n.º 4
0
 def test_project_edit_form(self):
     self.user = test_data.createDummyUserRandom(login='******', password='******')
     self.client.login(username=self.user.username, password='******')
     self.client.login(username='******', password='******')
     response = self.client.get(_reverse('edit_form', project_id=self.project.id))
     self.assertTemplateUsed(response, 'core2/project_edit.html')
     project = response.context['project']
     self.assertEqual('Hibernate', project.name)
    def test_should_send_mail_for_starting_or_aborting_or_finishing_work(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.post(reverse('core.views.json_views.toggle_watch'), {'entity': 'ISSUE', 'objid': issue.id})
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login='******', password='******')
        user2ScreenName = user2.getUserInfo().screenName
        client2 = Client()
        client2.login(username=user2.username, password='******')

        #STARTS WORKING
        email_asserts.clear_sent()
        response = client2.post('/core/solution/add/submit',
            {'issue_id': str(issue.id),
             'comment':''})
        self.assertEqual(response.status_code, 302)
        issue_id = response.get('location').split('/')[-2]
        response = client2.get('/core/issue/%s/blah'%issue_id)
        solution_id = str(response.context['mysolution'].id)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s has just begun working on issue [%s]"%(user2ScreenName, issue.title))

        #ABORTS WORK
        email_asserts.clear_sent()
        response = client2.post('/core/solution/abort/submit',
            {'solution_id': solution_id,
             'comment':''})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s has stopped working on issue [%s]"%(user2ScreenName, issue.title))

        #STARTS WORKING again
        email_asserts.clear_sent()
        response = client2.post('/core/solution/add/submit',
            {'issue_id': str(issue.id),
             'comment':''})
        self.assertEqual(response.status_code, 302)
        issue_id = response.get('location').split('/')[-2]
        response = client2.get('/core/issue/%s/blah'%issue_id)
        solution_id2 = str(response.context['mysolution'].id)
        self.assertEqual(solution_id, solution_id2)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s has just begun working on issue [%s]"%(user2ScreenName, issue.title))

        #FINISHES WORK
        email_asserts.clear_sent()
        response = client2.post('/core/solution/resolve/submit',
            {'solution_id': solution_id,
             'comment':''})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s resolved issue [%s]"%(user2ScreenName, issue.title))
    def test_should_send_mail_for_starting_or_aborting_or_finishing_work(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.get("/core/watch/issue/%s" % issue.id)
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login="******", password="******")
        user2ScreenName = user2.getUserInfo().screenName
        client2 = Client()
        client2.login(username=user2.username, password="******")

        # STARTS WORKING
        email_asserts.clear_sent()
        response = client2.post("/core/solution/add/submit", {"issue_id": str(issue.id), "comment": ""})
        self.assertEqual(response.status_code, 302)
        issue_id = response.get("location").split("/")[-2]
        response = client2.get("/core/issue/%s/blah" % issue_id)
        solution_id = str(response.context["mysolution"].id)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(
            self, to=self.user.email, subject="%s has just begun working on issue [%s]" % (user2ScreenName, issue.title)
        )

        # ABORTS WORK
        email_asserts.clear_sent()
        response = client2.post("/core/solution/abort/submit", {"solution_id": solution_id, "comment": ""})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(
            self, to=self.user.email, subject="%s has stopped working on issue [%s]" % (user2ScreenName, issue.title)
        )

        # STARTS WORKING again
        email_asserts.clear_sent()
        response = client2.post("/core/solution/add/submit", {"issue_id": str(issue.id), "comment": ""})
        self.assertEqual(response.status_code, 302)
        issue_id = response.get("location").split("/")[-2]
        response = client2.get("/core/issue/%s/blah" % issue_id)
        solution_id2 = str(response.context["mysolution"].id)
        self.assertEqual(solution_id, solution_id2)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(
            self, to=self.user.email, subject="%s has just begun working on issue [%s]" % (user2ScreenName, issue.title)
        )

        # FINISHES WORK
        email_asserts.clear_sent()
        response = client2.post("/core/solution/resolve/submit", {"solution_id": solution_id, "comment": ""})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(
            self, to=self.user.email, subject="%s resolved issue [%s]" % (user2ScreenName, issue.title)
        )
Exemplo n.º 7
0
    def test_should_send_mail_for_starting_or_aborting_or_finishing_work(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.get('/core/watch/issue/%s'%issue.id)
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login='******', password='******')
        user2ScreenName = user2.getUserInfo().screenName
        client2 = Client()
        client2.login(username=user2.username, password='******')

        #STARTS WORKING
        email_asserts.clear_sent()
        response = client2.post('/core/solution/add/submit',
            {'issue_id': str(issue.id),
             'comment':''})
        self.assertEqual(response.status_code, 302)
        issue_id = response.get('location').split('/')[-2]
        response = client2.get('/core/issue/%s/blah'%issue_id)
        solution_id = str(response.context['mysolution'].id)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s has just begun working on issue [%s]"%(user2ScreenName, issue.title))

        #ABORTS WORK
        email_asserts.clear_sent()
        response = client2.post('/core/solution/abort/submit',
            {'solution_id': solution_id,
             'comment':''})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s has stopped working on issue [%s]"%(user2ScreenName, issue.title))

        #STARTS WORKING again
        email_asserts.clear_sent()
        response = client2.post('/core/solution/add/submit',
            {'issue_id': str(issue.id),
             'comment':''})
        self.assertEqual(response.status_code, 302)
        issue_id = response.get('location').split('/')[-2]
        response = client2.get('/core/issue/%s/blah'%issue_id)
        solution_id2 = str(response.context['mysolution'].id)
        self.assertEqual(solution_id, solution_id2)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s has just begun working on issue [%s]"%(user2ScreenName, issue.title))

        #FINISHES WORK
        email_asserts.clear_sent()
        response = client2.post('/core/solution/resolve/submit',
            {'solution_id': solution_id,
             'comment':''})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s resolved issue [%s]"%(user2ScreenName, issue.title))
Exemplo n.º 8
0
 def test_project_edit(self):
     self.user = test_data.createDummyUserRandom(login='******', password='******')
     self.client.login(username=self.user.username, password='******')
     file_obj = StringIO()
     setattr(file_obj, 'name', 'mock.jpg')
     with mock.patch.object(self.project, 'save') as _save:
         response = self.client.post(_reverse('edit'),
                                     {'id': self.project.id, 'image3x1': file_obj})
         self.assertTrue(_save.has_been_called())
     location = response._headers['location'][1]
     self.assertTrue(location.endswith(_reverse('view', project_id=self.project.id)))
    def test_should_send_mail_for_adding_or_changing_or_revoking_offer(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.get("/core/watch/issue/%s" % issue.id)
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login="******", password="******")
        user2ScreenName = user2.getUserInfo().screenName
        client2 = Client()
        client2.login(username=user2.username, password="******")

        email_asserts.clear_sent()
        response = client2.post(
            "/core/issue/sponsor/submit",
            {"issue_id": str(issue.id), "price": "20.00", "currency": "USD", "acceptanceCriteria": "some criteria"},
        )
        self.assertEqual(response.status_code, 302)
        offer_id = response.get("location").split("/")[-2]

        email_asserts.assert_sent_count(self, 2)  # one to the watcher, other to the site admin
        email_asserts.assert_sent(
            self,
            to=self.user.email,
            subject="%s made a US$ 20.00 offer for issue [%s]" % (user2ScreenName, issue.title),
        )

        email_asserts.clear_sent()
        response = client2.post(
            "/core/offer/edit/submit",
            {"offer_id": offer_id, "currency": "USD", "price": "30.00", "acceptanceCriteria": "some criteria"},
        )
        self.assertEqual(response.status_code, 302)
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(
            self,
            to=self.user.email,
            subject="%s raised the US$ 20.00 offer on issue [%s]" % (user2ScreenName, issue.title),
        )

        email_asserts.clear_sent()
        response = client2.post("/core/offer/revoke/submit", {"offer_id": offer_id, "comment": ""})
        self.assertEqual(response.status_code, 302)
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(
            self,
            to=self.user.email,
            subject="%s revoked his US$ 30.00 offer for issue [%s]" % (user2ScreenName, issue.title),
        )
    def test_should_send_mail_for_new_comments(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.post(reverse('core.views.json_views.toggle_watch'), {'entity': 'ISSUE', 'objid': issue.id})
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login='******', password='******')
        client2 = Client()
        client2.login(username=user2.username, password='******')

        email_asserts.clear_sent()
        response = client2.post('/issue/comment/add/submit', {'issue_id': str(issue.id), 'content': 'Im adding a comment'})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s added a comment on issue [%s]"%(user2.getUserInfo().screenName, issue.title))

        email_asserts.clear_sent()
Exemplo n.º 11
0
    def test_should_send_mail_for_new_comments(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.post(reverse('core.views.json_views.toggle_watch'), {'entity': 'ISSUE', 'objid': issue.id})
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login='******', password='******')
        client2 = Client()
        client2.login(username=user2.username, password='******')

        email_asserts.clear_sent()
        response = client2.post('/issue/comment/add/submit', {'issue_id': str(issue.id), 'content': 'Im adding a comment'})
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s added a comment on issue [%s]"%(user2.username, issue.title))

        email_asserts.clear_sent()
    def test_should_send_mail_for_adding_or_changing_or_revoking_offer(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.get('/core/watch/issue/%s'%issue.id)
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login='******', password='******')
        user2ScreenName = user2.getUserInfo().screenName
        client2 = Client()
        client2.login(username=user2.username, password='******')

        email_asserts.clear_sent()
        response = client2.post('/core/issue/sponsor/submit',
            {'issue_id': str(issue.id),
             'price':'20.00',
             'currency' : 'USD',
             'acceptanceCriteria':'some criteria',})
        self.assertEqual(response.status_code, 302)
        offer_id = response.get('location').split('/')[-2]

        email_asserts.send_emails()
        email_asserts.assert_sent_count(self, 2) #one to the watcher, other to the site admin
        email_asserts.assert_sent(self, to=self.user.email, subject="%s made a US$ 20.00 offer for issue [%s]"%(user2ScreenName, issue.title))

        email_asserts.clear_sent()
        response = client2.post('/core/offer/edit/submit',
            {'offer_id': offer_id,
             'currency':'USD',
             'price':'30.00',
             'acceptanceCriteria':'some criteria',})
        self.assertEqual(response.status_code, 302)
        email_asserts.send_emails()
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s raised the US$ 20.00 offer on issue [%s]"%(user2ScreenName, issue.title))

        email_asserts.clear_sent()
        response = client2.post('/core/offer/revoke/submit',
            {'offer_id': offer_id,
             'comment' : ''})
        self.assertEqual(response.status_code, 302)
        email_asserts.send_emails()
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s revoked his US$ 30.00 offer for issue [%s]"%(user2ScreenName, issue.title))
Exemplo n.º 13
0
    def test_should_send_mail_for_adding_or_changing_or_revoking_offer(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.post(reverse('core.views.json_views.toggle_watch'), {'entity': 'ISSUE', 'objid': issue.id})
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login='******', password='******')
        # user2ScreenName = user2.username
        client2 = Client()
        client2.login(username=user2.username, password='******')

        email_asserts.clear_sent()
        response = client2.post('/issue/sponsor/submit',
            {'issue_id': str(issue.id),
             'price': '20.00',
             'currency': 'USD',
             'acceptanceCriteria': 'some criteria'})
        self.assertEqual(response.status_code, 302)

        offer_id = issue.getOffers()[0].id

        email_asserts.assert_sent_count(self, 2) #one to the watcher, other to the site admin
        email_asserts.assert_sent(self, to=self.user.email, subject="%s made a US$ 20.00 offer for issue [%s]"%(user2.username, issue.title))

        email_asserts.clear_sent()
        response = client2.post('/offer/edit/submit',
            {'offer_id': offer_id,
             'currency': 'USD',
             'price': '30.00',
             'acceptanceCriteria': 'some criteria'})
        self.assertEqual(response.status_code, 302)
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s raised the US$ 20.00 offer on issue [%s]"%(user2.username, issue.title))

        email_asserts.clear_sent()
        response = client2.post('/offer/revoke/submit',
            {'offer_id': offer_id,
             'comment' : ''})
        self.assertEqual(response.status_code, 302)
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s revoked his US$ 30.00 offer for issue [%s]"%(user2.username, issue.title))
Exemplo n.º 14
0
    def test_should_send_mail_for_adding_or_changing_or_revoking_offer(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.get('/core/watch/issue/%s'%issue.id)
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login='******', password='******')
        user2ScreenName = user2.getUserInfo().screenName
        client2 = Client()
        client2.login(username=user2.username, password='******')

        email_asserts.clear_sent()
        response = client2.post('/core/issue/sponsor/submit',
            {'issue_id': str(issue.id),
             'price':'20.00',
             'currency' : 'USD',
             'acceptanceCriteria':'some criteria',})
        self.assertEqual(response.status_code, 302)
        offer_id = response.get('location').split('/')[-2]

        email_asserts.assert_sent_count(self, 2) #one to the watcher, other to the site admin
        email_asserts.assert_sent(self, to=self.user.email, subject="%s made a US$ 20.00 offer for issue [%s]"%(user2ScreenName, issue.title))

        email_asserts.clear_sent()
        response = client2.post('/core/offer/edit/submit',
            {'offer_id': offer_id,
             'currency':'USD',
             'price':'30.00',
             'acceptanceCriteria':'some criteria',})
        self.assertEqual(response.status_code, 302)
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s raised the US$ 20.00 offer on issue [%s]"%(user2ScreenName, issue.title))

        email_asserts.clear_sent()
        response = client2.post('/core/offer/revoke/submit',
            {'offer_id': offer_id,
             'comment' : ''})
        self.assertEqual(response.status_code, 302)
        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(self, to=self.user.email, subject="%s revoked his US$ 30.00 offer for issue [%s]"%(user2ScreenName, issue.title))
    def test_should_send_mail_for_new_comments(self):
        offer = test_data.create_dummy_offer_usd()
        issue = offer.issue
        response = self.client.get("/core/watch/issue/%s" % issue.id)
        self.assertEqual(response.status_code, 200)
        response = self.client.get("/core/watch/offer/%s" % offer.id)
        self.assertEqual(response.status_code, 200)

        user2 = test_data.createDummyUserRandom(login="******", password="******")
        client2 = Client()
        client2.login(username=user2.username, password="******")

        email_asserts.clear_sent()
        response = client2.post(
            "/core/issue/comment/add/submit", {"issue_id": str(issue.id), "content": "Im adding a comment"}
        )
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(
            self,
            to=self.user.email,
            subject="%s added a comment on issue [%s]" % (user2.getUserInfo().screenName, issue.title),
        )

        email_asserts.clear_sent()
        response = client2.post(
            "/core/offer/comment/add/submit", {"offer_id": str(offer.id), "content": "Im adding another comment"}
        )
        self.assertEqual(response.status_code, 302)

        email_asserts.assert_sent_count(self, 1)
        email_asserts.assert_sent(
            self,
            to=self.user.email,
            subject="%s added a comment on offer [US$ %s / %s]"
            % (user2.getUserInfo().screenName, "10.00", issue.title),
        )
 def setUp(self):
     self.user = test_data.createDummyUserRandom(login="******", password="******")
     self.another_user = test_data.createDummyUserRandom(login="******", password="******")
     self.client = Client()
 def setUp(self):
     # Every test needs a client.
     self.user = test_data.createDummyUserRandom(login='******', password='******')
     self.client = Client()
     self.client.login(username=self.user.username, password='******')
 def setUp(self):
     self.user = test_data.createDummyUserRandom(login='******', password='******')
     self.another_user = test_data.createDummyUserRandom(login='******', password='******')
     self.client = Client()
     self.client.login(username=self.user.username, password='******')
 def setUp(self):
     self.user = test_data.createDummyUserRandom(login="******", password="******")
     self.client = Client()
     self.client.login(username=self.user.username, password="******")