Пример #1
0
 def test_single_release(self):
     release = self.create_release(
         self.project, date_added=timezone.now() - timedelta(minutes=5)
     )
     assert bulk_fetch_project_latest_releases([self.project]) == [release]
     newer_release = self.create_release(self.project)
     assert bulk_fetch_project_latest_releases([self.project]) == [newer_release]
Пример #2
0
 def test_single_release(self):
     release = self.create_release(
         self.project,
         date_added=timezone.now() - timedelta(minutes=5),
     )
     assert bulk_fetch_project_latest_releases([self.project]) == [release]
     newer_release = self.create_release(self.project)
     assert bulk_fetch_project_latest_releases([self.project]) == [newer_release]
Пример #3
0
 def test_multi_releases(self):
     release = self.create_release(
         self.project,
         date_added=timezone.now() - timedelta(minutes=5),
     )
     other_project_release = self.create_release(self.other_project)
     assert set(bulk_fetch_project_latest_releases(
         [self.project, self.other_project],
     )) == set([release, other_project_release])
     release_2 = self.create_release(self.project)
     assert set(bulk_fetch_project_latest_releases(
         [self.project, self.other_project],
     )) == set([release_2, other_project_release])
Пример #4
0
 def test_multi_releases(self):
     release = self.create_release(
         self.project,
         date_added=timezone.now() - timedelta(minutes=5),
     )
     other_project_release = self.create_release(self.other_project)
     assert set(bulk_fetch_project_latest_releases(
         [self.project, self.other_project],
     )) == set([release, other_project_release])
     release_2 = self.create_release(self.project)
     assert set(bulk_fetch_project_latest_releases(
         [self.project, self.other_project],
     )) == set([release_2, other_project_release])
Пример #5
0
 def get_latest_release(self, event):
     cache_key = get_project_release_cache_key(event.group.project_id)
     latest_release = cache.get(cache_key)
     if latest_release is None:
         latest_releases = bulk_fetch_project_latest_releases(
             [event.group.project])
         if latest_releases:
             cache.set(cache_key, latest_releases[0], 600)
             return latest_releases[0]
         else:
             cache.set(cache_key, False, 600)
     return latest_release
Пример #6
0
 def test_multi_mixed_releases(self):
     release = self.create_release(self.project)
     assert set(
         bulk_fetch_project_latest_releases(
             [self.project, self.other_project])) == set([release])
Пример #7
0
 def test_multi_no_release(self):
     assert bulk_fetch_project_latest_releases(
         [self.project, self.other_project]) == []
Пример #8
0
 def test_single_no_release(self):
     assert bulk_fetch_project_latest_releases([self.project]) == []
Пример #9
0
 def test_multi_mixed_releases(self):
     release = self.create_release(self.project)
     assert set(bulk_fetch_project_latest_releases(
         [self.project, self.other_project],
     )) == set([release])
Пример #10
0
 def test_multi_no_release(self):
     assert bulk_fetch_project_latest_releases(
         [self.project, self.other_project],
     ) == []
Пример #11
0
 def test_single_no_release(self):
     assert bulk_fetch_project_latest_releases([self.project]) == []