Skip to content

Commit

Permalink
fix caching
Browse files Browse the repository at this point in the history
  • Loading branch information
northdpole committed Oct 29, 2023
1 parent 8031080 commit 24f7809
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ e2e:
[ -d "./venv" ] && . ./venv/bin/activate
export FLASK_APP=$(CURDIR)/cre.py
export FLASK_CONFIG=development
flask run&
flask run &
sleep 5
yarn test:e2e
sleep 20
killall yarn
killall flask

Expand Down
10 changes: 6 additions & 4 deletions application/frontend/src/test/basic-e2etest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('App.js', () => {
await page.click('#SearchButton');
await page.waitForSelector('.content', { timeout: 10000 });
const text = await page.$eval('.content', (e) => e.textContent);
expect(text).toContain('Document could not be loaded');
expect(text).toContain('No results match your search term');
});

it('can search for cryptography using the free text method and it returns both Nodes and CRES', async () => {
Expand All @@ -43,7 +43,7 @@ describe('App.js', () => {
await page.waitForSelector('.content', { timeout: 10000 });
await page.waitForSelector('.standard-page__links-container', { timeout: 10000 });
const text = await page.$eval('.content', (e) => e.textContent);
expect(text).not.toContain('Document could not be loaded');
expect(text).not.toContain('No results match your search term');

const results = await page.$$('.standard-page__links-container');
expect(results.length).toBeGreaterThan(1);
Expand All @@ -60,7 +60,7 @@ describe('App.js', () => {
await page.waitForSelector('.content', { timeout: 10000 });
await page.waitForSelector('.standard-page__links-container', { timeout: 10000 });
const text = await page.$$('.content', (e) => e.textContent);
expect(text).not.toContain('Document could not be loaded');
expect(text).not.toContain('No results match your search term');

// title match
const page_title = await page.$eval('.standard-page__heading', (e) => e.textContent);
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('App.js', () => {
await page.waitForSelector('.content', { timeout: 10000 });
await page.waitForSelector('.standard-page__links-container', { timeout: 10000 });
const text = await page.$$('.content', (e) => e.textContent);
expect(text).not.toContain('Document could not be loaded');
expect(text).not.toContain('No results match your search term');

// title match
const entry_title = await page.$eval('div.title.document-node', (e) => e.textContent);
Expand Down Expand Up @@ -162,7 +162,9 @@ describe('App.js', () => {
it('can smartlink', async () => {
const response = await page.goto('http://127.0.0.1:5000/smartlink/standard/CWE/1002');
expect(response.url()).toBe('http://127.0.0.1:5000/node/standard/CWE/sectionid/1002');

const redirectResponse = await page.goto('http://127.0.0.1:5000/smartlink/standard/CWE/404');
page.waitForNavigation('networkidle2');
expect(redirectResponse.url()).toBe('https://cwe.mitre.org/data/definitions/404.html');
});

Expand Down
3 changes: 0 additions & 3 deletions application/web/web_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ def find_document_by_tag() -> Any:


@app.route("/rest/v1/map_analysis", methods=["GET"])
@cache.cached(timeout=50, query_string=True)
def gap_analysis() -> Any:
database = db.Node_collection()
standards = request.args.getlist("standard")
Expand Down Expand Up @@ -260,7 +259,6 @@ def gap_analysis() -> Any:


@app.route("/rest/v1/map_analysis_weak_links", methods=["GET"])
@cache.cached(timeout=50, query_string=True)
def gap_analysis_weak_links() -> Any:
standards = request.args.getlist("standard")
key = request.args.get("key")
Expand Down Expand Up @@ -342,7 +340,6 @@ def fetch_job() -> Any:


@app.route("/rest/v1/standards", methods=["GET"])
@cache.cached(timeout=50)
def standards() -> Any:
conn = redis.connect()
standards = conn.get("NodeNames")
Expand Down

0 comments on commit 24f7809

Please sign in to comment.