-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To make it easier to use, the initial template files are fetched from…
… a pre-defined server modified: cmd/rfd/internal/config/initialise.go modified: cmd/rfd/internal/config/utilities.go new file: cmd/rfd/internal/config/utilities_test.go deleted: template/0001/installation.md
- Loading branch information
Showing
4 changed files
with
191 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package config | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func TestWriteTemplates(t *testing.T) { | ||
|
||
APP_CONFIG = &Configuration{} | ||
|
||
APP_CONFIG.RootDirectory = "/tmp" | ||
|
||
err := WriteTemplates() | ||
if err != nil { | ||
t.Errorf("Error writing templates: %s", err) | ||
} | ||
|
||
// Test for existence of readme.md | ||
_, err = os.Stat(APP_CONFIG.RootDirectory + PATH_SEPARATOR + "template" + PATH_SEPARATOR + "readme.md") | ||
if err != nil { | ||
t.Errorf("Error reading readme.md: %s", err) | ||
} | ||
log.Println("Readme.md template present in root directory ...") | ||
|
||
// Test for existence of states.yml | ||
_, err = os.Stat(APP_CONFIG.RootDirectory + PATH_SEPARATOR + "template" + PATH_SEPARATOR + "states.yml") | ||
if err != nil { | ||
t.Errorf("Error reading states.yml: %s", err) | ||
} | ||
log.Println("States.yml template present in root directory ...") | ||
|
||
// Test for existence of 0001 directory | ||
_, err = os.Stat(APP_CONFIG.RootDirectory + PATH_SEPARATOR + "template" + PATH_SEPARATOR + "0001") | ||
if err != nil { | ||
t.Errorf("Error reading 0001 directory: %s", err) | ||
} | ||
log.Println("0001 directory present in root directory ...") | ||
|
||
// Test for existence of readme.md | ||
_, err = os.Stat(APP_CONFIG.RootDirectory + PATH_SEPARATOR + "template" + PATH_SEPARATOR + "0001" + PATH_SEPARATOR + "readme.md") | ||
if err != nil { | ||
t.Errorf("Error reading readme.md: %s", err) | ||
} | ||
log.Println("Readme.md template present in 0001 directory ...") | ||
|
||
// Clean up | ||
log.Println("Cleaning up ...") | ||
|
||
// We only have rights to remove the files we created | ||
if err := os.Remove(APP_CONFIG.RootDirectory + PATH_SEPARATOR + "template" + PATH_SEPARATOR + "readme.md"); err != nil { | ||
t.Errorf("Error removing readme.md: %s", err) | ||
} | ||
log.Println("Removed readme.md ...") | ||
|
||
if err := os.Remove(APP_CONFIG.RootDirectory + PATH_SEPARATOR + "template" + PATH_SEPARATOR + "states.yml"); err != nil { | ||
t.Errorf("Error removing states.yml: %s", err) | ||
} | ||
log.Println("Removed states.yml ...") | ||
|
||
if err := os.Remove(APP_CONFIG.RootDirectory + PATH_SEPARATOR + "template" + PATH_SEPARATOR + "0001" + PATH_SEPARATOR + "readme.md"); err != nil { | ||
t.Errorf("Error removing readme.md: %s", err) | ||
} | ||
log.Println("Removed readme.md from 0001 directory ...") | ||
|
||
if err := os.RemoveAll(APP_CONFIG.RootDirectory + PATH_SEPARATOR + "template" + PATH_SEPARATOR + "0001"); err != nil { | ||
t.Errorf("Error removing 0001 directory contents: %s", err) | ||
} | ||
|
||
log.Println("Cleaned up ...") | ||
|
||
} |
This file was deleted.
Oops, something went wrong.