示例#1
0
 def as_dict_for_template_context(self):
     (data, person) = self.get_base_data_dict_and_person()
     if person:
         repo = controllers.GitRepository(self.request.user.username)
         data.update({
             'repository_exists': repo.exists(),
             'git_checkout_done': controllers.mission_completed(person, 'git_checkout'),
             'git_diff_done': controllers.mission_completed(person, 'git_diff'),
             'git_rebase_done': controllers.mission_completed(person, 'git_rebase'),
         })
         if data['repository_exists']:
           data.update({
             'checkout_url': repo.public_url,
           })
     return data
示例#2
0
 def test_do_rebase_mission_incorrectly(self):
     word = 'the wrong word'
     response = self.client.post(reverse(views.rebase_submit),
                                 {'secret_word': word})
     paulproteus = Person.objects.get(user__username='******')
     self.assertFalse(
         controllers.mission_completed(paulproteus, 'git_rebase'))
示例#3
0
 def test_do_checkout_mission_correctly(self):
     word = 'the brain'
     response = self.client.post(reverse(views.checkout_submit),
                                 {'secret_word': word})
     paulproteus = Person.objects.get(user__username='******')
     self.assert_(controllers.mission_completed(paulproteus,
                                                'git_checkout'))
示例#4
0
 def test_do_diff_mission_correctly(self):
     self.client.post(reverse(views.resetrepo))
     cwd=self.repo_path
     with open(os.path.join(cwd, '../../../missions/git/data/hello.patch'), 'r') as expected_diff_file:
         expected_diff = expected_diff_file.read()
     response = self.client.post(reverse(views.resetrepo))
     response = self.client.post(reverse(views.diff_submit), {'diff': expected_diff})
     paulproteus = Person.objects.get(user__username='******')
     self.assert_(controllers.mission_completed(paulproteus, 'git_diff'))
示例#5
0
 def as_dict_for_template_context(self):
     (data, person) = self.get_base_data_dict_and_person()
     if person:
         repo = controllers.GitRepository(self.request.user.username)
         data.update({
             'repository_exists':
             repo.exists(),
             'git_checkout_done':
             controllers.mission_completed(person, 'git_checkout'),
             'git_diff_done':
             controllers.mission_completed(person, 'git_diff'),
             'git_rebase_done':
             controllers.mission_completed(person, 'git_rebase'),
         })
         if data['repository_exists']:
             data.update({
                 'checkout_url': repo.public_url,
             })
     return data
示例#6
0
 def test_do_diff_mission_correctly(self):
     self.client.post(reverse(views.resetrepo))
     cwd = self.repo_path
     with open(os.path.join(cwd, '../../../missions/git/data/hello.patch'),
               'r') as expected_diff_file:
         expected_diff = expected_diff_file.read()
     response = self.client.post(reverse(views.resetrepo))
     response = self.client.post(reverse(views.diff_submit),
                                 {'diff': expected_diff})
     paulproteus = Person.objects.get(user__username='******')
     self.assert_(controllers.mission_completed(paulproteus, 'git_diff'))
示例#7
0
 def test_do_rebase_mission_incorrectly(self):
     word = 'the wrong word'
     response = self.client.post(reverse(views.rebase_submit), {'secret_word': word})
     paulproteus = Person.objects.get(user__username='******')
     self.assertFalse(controllers.mission_completed(paulproteus, 'git_rebase'))
示例#8
0
 def test_do_git_description_mission_correctly_with_weird_email_address(self):
     correct_email = '*****@*****.**'
     response = self.client.post(reverse(views.long_description_submit), {'user_email': correct_email})
     paulproteus = Person.objects.get(user__username='******')
     self.assertTrue(controllers.mission_completed(paulproteus, 'git_config'))
示例#9
0
 def test_do_git_description_mission_incorrectly(self):
     self.assertFalse(self.email_address_is_rejected('*****@*****.**'))
     self.assertFalse(self.email_address_is_rejected('filipovskii_off@Puppo.(none)'))
     paulproteus = Person.objects.get(user__username='******')
     self.assertFalse(controllers.mission_completed(paulproteus, 'git_config'))
示例#10
0
 def test_do_checkout_mission_correctly(self):
     word = 'the brain'
     response = self.client.post(reverse(views.checkout_submit), {'secret_word': word})
     paulproteus = Person.objects.get(user__username='******')
     self.assert_(controllers.mission_completed(paulproteus, 'git_checkout'))